#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@author:stone
@file:config.py
@time:2021/08/13
"""
import json

CONF_FILE = "config/config.json"


class Config:
    __instance = None
    github_token = ""
    gitee_token = ""
    gitlab_token = ""

    def __new__(cls, *args, **kwargs):
        if cls.__instance == None:
            cls.__instance = object.__new__(cls)
        return cls.__instance

    def __init__(self):
        with open(CONF_FILE, "r") as f:
            json_str = json.load(f)
            self.github_token = json_str["github"]["access_token"]
            self.gitee_token = json_str["gitee"]["access_token"]
            self.gitlab_token = json_str["gitlab"]["access_token"]
